import 'package:auto_size_text/auto_size_text.dart';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../generated/l10n.dart';
import '../utils/CommUtils.dart';
import '../view/_OverScrollBehavior.dart';
import '../wight/My.dart';

/**
 * 帮助文档
 */
class HelpPage extends StatelessWidget {
  const HelpPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
         double hight=CommUtils.getHeight(context);
    return Scaffold(
      body: Container(
        height: double.infinity,
        width: double.infinity,
        decoration: BoxDecoration(
          image: DecorationImage(
            image: AssetImage('assets/images/bg.png'),
            fit: BoxFit.fill,
          ),
        ),
        child: Column(
          children: [
            Image.asset('assets/images/top_leaves.png',
                width: double.infinity,
                height: ScreenUtil().setHeight(30),
                fit: BoxFit.fill),
            SizedBox(
              height: ScreenUtil().setHeight(15),
            ),
            //顶部垂直居中
            Container(
              padding: EdgeInsets.only(left: 10),
              height: ScreenUtil().setHeight(35),
              child: Stack(
                children: [
                  Align(
                    alignment: Alignment.centerLeft,
                    child: GestureDetector(
                      onTap: (() {
                        Navigator.pop(context);
                      }),
                      child: Image.asset('assets/images/back.png',
                           width: ScreenUtil().setWidth(40),
                          height: ScreenUtil().setHeight(35),
                          fit: BoxFit.contain),
                    ),
                  ),
                  Align(
                    alignment: Alignment.center,
                    child: CommUtils.getTextGame(context, 20,
                        S.of(context).jiaocheng_, textColor, textbgColor),
                  ),
                ],
              ),
            ),
            Expanded(
              child: ScrollConfiguration(
                behavior: OverScrollBehavior(),
                child: Padding(
                  padding: EdgeInsets.only(
                    left: ScreenUtil().setWidth(15),
                    right: ScreenUtil().setWidth(15),
                  ),
                  child: ListView(
                    children: [
                      getBox(),
                      getText1(S.of(context).help1),
                      getText(S.of(context).help2),
                      getText(S.of(context).help3),
                      getText(S.of(context).help4),
                      getText(S.of(context).help5),
                      getText(S.of(context).help6),
                      getBox(),
                      getText1(S.of(context).help7),
                      getText(S.of(context).help8),
                      getBox(),
                      getText1(S.of(context).help9), //宝石
                      getText(S.of(context).help10),
                      getText(S.of(context).help11),
                      getBox(),

                      getText1(S.of(context).help12),
                      getText(S.of(context).help13),
                      getBox(),

                      getText1(S.of(context).help14),
                      getText(S.of(context).help15),
                      getBox(),

                      getText1(S.of(context).help16),
                      getText(S.of(context).help17),
                    ],
                  ),
                ),
              ),
            ),
           Image.asset('assets/images/botton_.png',
              width: double.infinity,height: hight*0.09, fit: BoxFit.fill)
          ],
        ),
      ),
    );
  }

  Widget getBox() {
    return SizedBox(height: ScreenUtil().setHeight(13));
  }

  Widget getText(String text) {
    return Align(
      alignment: Alignment.centerLeft,
      child: Padding(
        padding: EdgeInsets.only(left: ScreenUtil().setWidth(10)),
        child: AutoSizeText(
          text,
          style: TextStyle(
            fontSize: ScreenUtil().setSp(15),
            color: Color.fromRGBO(255, 255, 255, 1),
          ),
        ),
      ),
    );
  }

  Widget getText1(String text) {
    return Align(
      alignment: Alignment.centerLeft,
      child: AutoSizeText(
        text,
        style: TextStyle(
          fontSize: ScreenUtil().setSp(15),
          color: Color.fromRGBO(255, 255, 255, 1),
        ),
      ),
    );
  }
}
